package com.androidx.p013lv.mine.model;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.androidx.p013lv.base.bean.VideoHistory;
import com.androidx.p013lv.base.utils.VideoHistoryUtils;
import java.util.List;
import p023io.reactivex.android.schedulers.AndroidSchedulers;
import p023io.reactivex.disposables.CompositeDisposable;
import p023io.reactivex.functions.Action;
import p023io.reactivex.functions.Consumer;
import p023io.reactivex.schedulers.Schedulers;

/* renamed from: com.androidx.lv.mine.model.MineHistoryModel */
public class MineHistoryModel extends ViewModel {
    private MutableLiveData<List<VideoHistory>> videoHistory;

    public MutableLiveData<List<VideoHistory>> data() {
        if (this.videoHistory == null) {
            this.videoHistory = new MutableLiveData<>();
        }
        return this.videoHistory;
    }

    public void getHistoryVideo(Long l) {
        final CompositeDisposable compositeDisposable = new CompositeDisposable();
        compositeDisposable.add(VideoHistoryUtils.getInstance().select(l).subscribeOn(Schedulers.m1118io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<List<VideoHistory>>() {
            /* class com.androidx.p013lv.mine.model.MineHistoryModel.C13571 */

            public void accept(List<VideoHistory> list) throws Exception {
                MineHistoryModel.this.videoHistory.setValue(list);
                compositeDisposable.clear();
            }
        }));
    }

    public void deleteVideoList(List<VideoHistory> list) {
        final CompositeDisposable compositeDisposable = new CompositeDisposable();
        compositeDisposable.add(VideoHistoryUtils.getInstance().delete(list).subscribeOn(Schedulers.m1118io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action() {
            /* class com.androidx.p013lv.mine.model.MineHistoryModel.C13582 */

            @Override // p023io.reactivex.functions.Action
            public void run() throws Exception {
                compositeDisposable.clear();
            }
        }));
    }

    public void deleteVideoHistory(VideoHistory videoHistory2) {
        final CompositeDisposable compositeDisposable = new CompositeDisposable();
        compositeDisposable.add(VideoHistoryUtils.getInstance().delete(videoHistory2).subscribeOn(Schedulers.m1118io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action() {
            /* class com.androidx.p013lv.mine.model.MineHistoryModel.C13593 */

            @Override // p023io.reactivex.functions.Action
            public void run() throws Exception {
                compositeDisposable.clear();
            }
        }));
    }
}
